package ac.svn.accesscontrol.store;

import java.util.HashSet;
import java.util.Set;

public class SVNGroup implements Comparable<SVNGroup>,ISVNItem{
	private String groupAlias;
	private String groupName;
	private Set<String> groupMembers;
	public String getGroupAlias() {
		return groupAlias;
	}
	public void setGroupAlias(String groupAlias) {
		this.groupAlias = groupAlias;
	}
	public String getGroupName() {
		return groupName;
	}
	public void setGroupName(String groupName) {
		this.groupName = groupName;
	}
	public Set<String> getGroupMembers() {
		return groupMembers;
	}
	public void setGroupMembers(Set<String> groupMembers) {
		this.groupMembers = groupMembers;
	}
	
	public void addMember(String userId)
	{
		this.groupMembers.add(userId)  ;
	}
	public SVNGroup() {
		super();
		this.groupAlias = null;;
		this.groupName = null;
		this.groupMembers = new HashSet<String>();
	}

	public SVNGroup(String groupAlias, String groupName) {
		super();
		this.groupAlias = groupAlias;
		this.groupName = groupName;
		this.groupMembers = new HashSet<String>();
	}
	@Override
	public String toString() {
		return "<HTML><b>" + groupAlias + "</b> [" + groupMembers.size() + "]";
	}
	@Override
	public String getName() {
		return getGroupName();
	}
	@Override
	public int compareTo(SVNGroup o) {
		return groupName.compareTo(o.getGroupName());
	}
	@Override
	public String getTooltipText() {
		return "<HTML>SVNGroup <br>GroupAlias=" + groupAlias + "<br>GroupName="
		+ groupName + "<br>GroupMembers=" + groupMembers + "</HTML>";
	}
	
	
}
